package zeebe.export;

import io.vertx.core.json.JsonObject;
import io.zeebe.client.ZeebeClient;
import io.zeebe.client.api.response.WorkflowInstanceEvent;

public class ExportStart {
    public static void main(String[] args) {
        ZeebeClient client = ZeebeClient.newClientBuilder()
                .brokerContactPoint("localhost:26500")
                .usePlaintext()
                .build();

        System.out.println("启动工作流");
        String processId = "exportDemo";

        JsonObject data = new JsonObject()
                .put("a", 1)
                .put("b", 2);

        WorkflowInstanceEvent wfInstance = client.newCreateInstanceCommand()
                .bpmnProcessId(processId)
                .latestVersion()
                .variables(data.encode())
                .send()
                .join();
    }
}
